package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;

import com.itheima.health.service.SmsService;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@Slf4j
@RequestMapping("/mobile/validateCode")
public class MobileValidateCodeController {

    @Autowired
    private SmsService smsService;

   @PostMapping("/send")
    public Result send(String type, String telephone) {
        log.info("[验证码-发送]type:{},telephone:{}", type, telephone);
        //rpc调用发送验证码
        smsService.sendValidateCode(type, telephone);
        return new Result(true, MessageConst.SEND_VALIDATECODE_SUCCESS);
    }
}
